﻿Public Class FrmSettings

  Private Sub FrmSettings_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    grd.SelectedObject = My.Settings
  End Sub

  Private Sub FrmSettings_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
    Dim dr = MessageBox.Show("You are closing settings editor. Would you like to save changes?", "Save changes...", MessageBoxButtons.YesNoCancel, _
                              MessageBoxIcon.Question)

    Select Case dr
      Case Windows.Forms.DialogResult.Yes
        My.Settings.Save()
      Case Windows.Forms.DialogResult.No
        My.Settings.Reload()
      Case Windows.Forms.DialogResult.Cancel
        e.Cancel = True
    End Select
  End Sub
End Class